; *** Checkers
; *** Copyright 1998-2003 Zillions Development
; v.2.0.1

; You need to purchase Zillions of Games to load this rules file
; Visit the Zillions web site at http://www.zillions-of-games.com
(translate
 ("Checkers" "西洋跳棋")
 ("NW Diagonal Checkers" "左上-右下布局")
 ("NE Diagonal Checkers" "左下-右上布局")
 ("Losing Checkers" "逆西洋跳棋")
 ("Double-Back Checkers" "往返西洋跳棋")
 ("Checkers 10x10 (15 men)" "10x10 西洋跳棋 - 15子")
 ("Checkers 10x10 (20 men)" "10x10 西洋跳棋 - 20子")
 ("International Checkers 10x10" "百格国际跳棋 (10x10)")
 ("Frisian Checkers 10x10" "弗里斯兰跳棋 (10x10)")
 ("Italian Checkers" "意大利跳棋")
 ("German Checkers" "德国跳棋")
 ("Russian Checkers" "俄国跳棋")
 ("Pool Checkers" "美国跳棋")
 ("Spanish Checkers" "西班牙跳棋")
 ("Central-South German Checkers" "德国跳棋-德国南部规则")
 ("Scandinavian Checkers" "挪威跳棋")
 ("Gothic Checkers" "哥特跳棋")
 ("Turkish Checkers" "土耳其跳棋")
 ("Armenian Checkers" "亚美尼亚跳棋")
)


(version "2.0")

; ********************** Board definitions

; Mirrored means board mirrored across axis (double-corner on opposite side)

; image
(define image-8x8 (image "images\Checkers\Shaag\checkbd2.bmp" "images\Checkers\checkbd2.bmp") )
(define image-8x8-mirrored (image "images\Checkers\Shaag\checkbd2_italian.bmp" "images\Checkers\checkbd2_italian.bmp") )
(define image-10x10 (image "images\Checkers\Shaag\checkbd10x10.bmp" "images\Checkers\checkbd10x10.bmp") )

; symmetry
(define symmetry-dark-bottom  (symmetry Red   (nw sw)(sw nw) (ne se)(se ne)) )
(define symmetry-light-bottom (symmetry Black (nw sw)(sw nw) (ne se)(se ne)) )

; grid
(define grid-8x8
  (grid
     (start-rectangle 6 6 55 55)
     (dimensions
         ("a/b/c/d/e/f/g/h" (50 0)) ; files
         ("8/7/6/5/4/3/2/1" (0 50)) ; ranks
     )
     (directions (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1))
  )
)
(define grid-10x10
  (grid
     (start-rectangle 6 6 55 55)
     (dimensions
         ("a/b/c/d/e/f/g/h/i/j" (50 0)) ; files
         ("10/9/8/7/6/5/4/3/2/1" (0 50)) ; ranks
     )
     (directions (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1)
                 (nn 0 -2) (ww -2 0) (ss 0 2) (ee 2 0))
  )
)

; board-setup
(define board-setup-8x8
   (board-setup
      (Black (Checker a1 c1 e1 g1 b2 d2 f2 h2 a3 c3 e3 g3) )
      (Red   (Checker b8 d8 f8 h8 a7 c7 e7 g7 b6 d6 f6 h6) )
   )
)
(define board-setup-8x8-mirrored
   (board-setup
      (Black (Checker b1 d1 f1 h1 a2 c2 e2 g2 b3 d3 f3 h3) )
      (Red   (Checker a8 c8 e8 g8 b7 d7 f7 h7 a6 c6 e6 g6) )
   )
)
(define board-setup-8x8-light-bottom
   (board-setup
      (Red   (Checker a1 c1 e1 g1 b2 d2 f2 h2 a3 c3 e3 g3) )
      (Black (Checker b8 d8 f8 h8 a7 c7 e7 g7 b6 d6 f6 h6) )
   )
)
(define board-setup-8x8-mirrored-light-bottom
   (board-setup
      (Red   (Checker b1 d1 f1 h1 a2 c2 e2 g2 b3 d3 f3 h3) )
      (Black (Checker a8 c8 e8 g8 b7 d7 f7 h7 a6 c6 e6 g6) )
   )
)

; links
(define next-links-8x8
      (dummy offboard)
      (links next  (a1 c1) (c1 e1) (e1 g1) (g1 b2)
                   (b2 d2) (d2 f2) (f2 h2) (h2 a3)
                   (a3 c3) (c3 e3) (e3 g3) (g3 b4)
                   (b4 d4) (d4 f4) (f4 h4) (h4 a5)
                   (a5 c5) (c5 e5) (e5 g5) (g5 b6)
                   (b6 d6) (d6 f6) (f6 h6) (h6 a7)
                   (a7 c7) (c7 e7) (e7 g7) (g7 b8)
                   (b8 d8) (d8 f8) (f8 h8) (h8 offboard)
      )
)
(define next-links-8x8-mirrored
      (dummy offboard)
      (links next  (a1 a8) ; eating macro starts off at a1
                   (a8 c8) (c8 e8) (e8 g8) (g8 b7)
                   (b7 d7) (d7 f7) (f7 h7) (h7 a6)
                   (a6 c6) (c6 e6) (e6 g6) (g6 b5)
                   (b5 d5) (d5 f5) (f5 h5) (h5 a4)
                   (a4 c4) (c4 e4) (e4 g4) (g4 b3)
                   (b3 d3) (d3 f3) (f3 h3) (h3 a2)
                   (a2 c2) (c2 e2) (e2 g2) (g2 b1)
                   (b1 d1) (d1 f1) (f1 h1) (h1 offboard)
      )
)

; zone
(define promotion-zone-8x8
   (zone (name promotion-zone) (players Black) (positions b8 d8 f8 h8) )
   (zone (name promotion-zone) (players Red)   (positions a1 c1 e1 g1) )
)
(define promotion-zone-8x8-light-bottom
   (zone (name promotion-zone) (players Red)   (positions b8 d8 f8 h8) )
   (zone (name promotion-zone) (players Black) (positions a1 c1 e1 g1) )
)
(define promotion-zone-8x8-mirrored
   (zone (name promotion-zone) (players Black) (positions a8 c8 e8 g8) )
   (zone (name promotion-zone) (players Red)   (positions b1 d1 f1 h1) )
)
(define promotion-zone-8x8-mirrored-light-bottom
   (zone (name promotion-zone) (players Red)   (positions a8 c8 e8 g8) )
   (zone (name promotion-zone) (players Black) (positions b1 d1 f1 h1) )
)

(define board-defs-international
      (image-10x10)
      (grid-10x10)
      (symmetry-light-bottom)
      (dummy offboard)
      (links next (a1 c1) (c1 e1) (e1 g1) (g1 i1) (i1 b2)
                  (b2 d2) (d2 f2) (f2 h2) (h2 j2) (j2 a3)
                  (a3 c3) (c3 e3) (e3 g3) (g3 i3) (i3 b4)
                  (b4 d4) (d4 f4) (f4 h4) (h4 j4) (j4 a5)
                  (a5 c5) (c5 e5) (e5 g5) (g5 i5) (i5 b6)
                  (b6 d6) (d6 f6) (f6 h6) (h6 j6) (j6 a7)
                  (a7 c7) (c7 e7) (e7 g7) (g7 i7) (i7 b8)
                  (b8 d8) (d8 f8) (f8 h8) (h8 j8) (j8 a9)
                  (a9 c9) (c9 e9) (e9 g9) (g9 i9) (i9 b10)
                  (b10 d10) (d10 f10) (f10 h10) (h10 j10) (j10 a10) (a10 offboard)
	  )
      (zone (name promotion-zone) (players Black) (positions  a1  c1  e1  g1  i1) )
      (zone (name promotion-zone) (players Red)   (positions b10 d10 f10 h10 j10) )
)

(define board-defs-turkish
  (image "images\Checkers\Shaag\Turkish_checkbd2.bmp" "images\Checkers\Turkish_checkbd2.bmp")
  (grid
     (start-rectangle 6 6 55 55)
     (dimensions
         ("a/b/c/d/e/f/g/h" (50 0)) ; files
         ("8/7/6/5/4/3/2/1" (0 50)) ; ranks
     )
     (directions (n 0 -1) (s 0 1) (e 1 0) (w -1 0) (nw -1 -1) (ne 1 -1) (se 1 1) (sw -1 1))
  )
  (symmetry Red (n s)(s n) (ne sw) (sw ne) (nw se) (se nw))
  (dummy offboard)
  (links next         (a1 a2) (a2 a3) (a3 a4) (a4 a5) (a5 a6) (a6 a7) (a7 a8) (a8 b1) 
                      (b1 b2) (b2 b3) (b3 b4) (b4 b5) (b5 b6) (b6 b7) (b7 b8) (b8 c1) 
                      (c1 c2) (c2 c3) (c3 c4) (c4 c5) (c5 c6) (c6 c7) (c7 c8) (c8 d1) 
                      (d1 d2) (d2 d3) (d3 d4) (d4 d5) (d5 d6) (d6 d7) (d7 d8) (d8 e1) 
                      (e1 e2) (e2 e3) (e3 e4) (e4 e5) (e5 e6) (e6 e7) (e7 e8) (e8 f1) 
                      (f1 f2) (f2 f3) (f3 f4) (f4 f5) (f5 f6) (f6 f7) (f7 f8) (f8 g1) 
                      (g1 g2) (g2 g3) (g3 g4) (g4 g5) (g5 g6) (g6 g7) (g7 g8) (g8 h1) 
                      (h1 h2) (h2 h3) (h3 h4) (h4 h5) (h5 h6) (h6 h7) (h7 h8) (h8 offboard)
  )
  (zone (name promotion-zone) (players Black) (positions a8 b8 c8 d8 e8 f8 g8 h8) )
  (zone (name promotion-zone) (players Red)   (positions a1 b1 c1 d1 e1 f1 g1 h1) )
  (zone (name allboardzone)   (players Red Black)
      (positions a1 b1 c1 d2 e1 f1 g1 h1
		 a2 b3 c2 d2 e2 f2 g2 h2
		 a3 b3 c3 d3 e3 f3 g3 h3
		 a4 b4 c4 d4 e4 f4 g4 h4
		 a5 b5 c5 d5 e5 f5 g5 h5
		 a6 b6 c6 d6 e6 f6 g6 h6
		 a7 b7 c7 d7 e7 f7 g7 h7
		 a8 b8 c8 d8 e8 f8 g8 h8)
  )
)

; ********************** 

(define checker-add
   (if (not-in-zone? promotion-zone)
      add
    else
      (add King)
   )
)
(define checker-jump-add
   (if (not-in-zone? promotion-zone)
      (add-partial jumptype)
    else
      (add King)
   )
)
(define checker-shift  ($1 (verify empty?) (checker-add)) )
(define checker-jump   ($1 (verify enemy?) capture $1 (verify empty?) (checker-jump-add)) )

(define king-shift     ($1 (verify empty?) add) )
(define king-jump      ($1 (verify enemy?) capture $1 (verify empty?) (add-partial jumptype)) )

(define scchecker-jump
   ($1 (while empty? $1) (verify enemy?) $1
      (while empty?
         ; search backwards for enemy and capture
         mark
         (opposite $1) (while not-enemy? (opposite $1))
         capture
         back
         ; add jump
         (checker-jump-add)
         $1
      )
   )
)


; **************************************************************8


(game
   (title "Checkers")
   (description "棋子可以斜向前走一步，也可以斜着向前跳过对方的子至一空格，并吃掉该子。\可以连吃，且能吃子时必须吃子，不能走其他步。\\棋子到达对方底线变为王，可以斜退，也可以斜后方向跳吃。\\吃光对方所有子，或使对方无法移动，即获胜。")
   (history "Checkers or `Draughts` has been played since medieval times, but was derived
	from a much older Arab game, `Alquerque`.")
   (strategy "Plan ahead and try not to leave your opponent with multiple jumps.")
   (option "prevent flipping" 2)
   (click-sound "Audio\\WoodClick.wav")
   (release-sound "Audio\\WoodClick.wav")
   (move-sound "Audio\\WoodClick.wav")
   (players Black Red)
   (turn-order Black Red)
   (move-priorities jumptype nonjumptype)

   (board
      (image-8x8)
      (grid-8x8)
      (symmetry-dark-bottom)
      (next-links-8x8) ; next links for use by the variants
      (promotion-zone-8x8)
   )

   (board-setup
      (Black (Checker a1 c1 e1 g1 b2 d2 f2 h2 a3 c3 e3 g3) )
      (Red   (Checker b8 d8 f8 h8 a7 c7 e7 g7 b6 d6 f6 h6) )
   )

   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp"
             Black "images\Checkers\Shaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (description "棋子可以斜向前走一步，也可以斜着向前跳过对方的子至一空格，并吃掉该子。\可以连吃，且能吃子时必须吃子，不能走其他步。\\棋子到达对方底线变为王。")
      (help "棋子可以斜前移动，跳吃。")
      (moves
         (move-type jumptype)
         (checker-jump nw)
         (checker-jump ne)

         (move-type nonjumptype)
         (checker-shift nw)
         (checker-shift ne)
      )
   )
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\chkrRK.bmp" "images\Checkers\chkrRK.bmp"
             Black "images\Checkers\Shaag\chkrBK.bmp" "images\Checkers\chkrBK.bmp")
      (description "王：斜方向四个方向均可走，也可跳吃。")
      (help "王：斜向移动，跳吃")
      (moves
         (move-type jumptype)
         (king-jump nw)
         (king-jump ne)
         (king-jump sw)
         (king-jump se)

         (move-type nonjumptype)
         (king-shift nw)
         (king-shift ne)
         (king-shift sw)
         (king-shift se)
      )
   )

   ; pieces used in some variants
   (piece
      (name XChecker)
      (image Red "images\Checkers\Shaag\XChkrRM.bmp" "images\Checkers\XChkrRM.bmp"
             Black "images\Checkers\Shaag\XChkrBM.bmp" "images\Checkers\XChkrBM.bmp")
      (help "Checker: marked for capture")
   )
   (piece
      (name XKing)
      (image Red "images\Checkers\Shaag\XChkrRK.bmp" "images\Checkers\XChkrRK.bmp"
             Black "images\Checkers\Shaag\XChkrBK.bmp" "images\Checkers\XChkrBK.bmp")
      (help "King: marked for capture")
   )

   ; object of the game
   (loss-condition (Red Black) (pieces-remaining 0) )
   (loss-condition (Red Black) stalemated )
)

(variant
   (title "-") ; ********* Variants *********
)

(variant
   (title "NW Diagonal Checkers")
   (description "兵升变位置在对方角落的四个黑格。\\其他同西洋跳棋。")
   (board
      (image-8x8)
      (grid-8x8)
      (symmetry-dark-bottom)
      (zone
         (name promotion-zone)
         (players Black)
         (positions a5 a7 b8 d8)
      )
      (zone
         (name promotion-zone)
         (players Red)
         (positions e1 g1 h2 h4)
      )
   )
   (board-setup
      (Red   (Checker a3 a5 a7 b4 b6 b8 c5 c7 d6 d8 e7 f8) )
      (Black (Checker h6 h4 h2 g1 g3 g5 f2 f4 e1 e3 d2 c1) )
   )
)

(variant
   (title "NE Diagonal Checkers")
   (description "兵升变位置在对方角落的四个黑格。\\其他同西洋跳棋。")
   (board
      (image-8x8)
      (grid-8x8)
      (symmetry-dark-bottom)
      (zone
         (name promotion-zone)
         (players Black)
         (positions f8 h8 h6)
      )
      (zone
         (name promotion-zone)
         (players Red)
         (positions a1 a3 c1)
      )
   )
   (board-setup
      (Red   (Checker h8 h6 h4 g7 g5 f8 f6 e7 d8) )
      (Black (Checker a1 a3 a5 b2 b4 c1 c3 d2 e1) )
   )
)

(variant
   (title "Losing Checkers")
   (description "让对方吃光自己所有子，或自己无路可走才可获胜。\\其他同西洋跳棋。")
   (win-condition (Red Black) (pieces-remaining 0) )
   (win-condition (Red Black) stalemated )
)

(variant
   (title "Double-Back Checkers")
   (description "你可以让一个升变成功的棋子（王）返回底线来取得胜利。\\其他同西洋跳棋。")
   (loss-condition (Red Black) (pieces-remaining 0) )
   (loss-condition (Red Black) stalemated)
   (win-condition (Red) (or (absolute-config King (b8))
                            (absolute-config King (d8))
                            (absolute-config King (f8))
                            (absolute-config King (h8))
                        )
   )
   (win-condition (Black) (or (absolute-config King (a1))
                              (absolute-config King (c1))
                              (absolute-config King (e1))
                              (absolute-config King (g1))
                          )
   )
)

(variant
   (title "-") ; --------------------------------------------------------
)

(variant
   (title "Checkers 10x10 (15 men)")
   (description "如果你有多个吃子路线可以选择，你必须选择可以吃掉最多棋子的路线。\\其他同西洋跳棋。")
   (option "maximal captures" 2)
   (board
      (image-10x10)
      (grid-10x10)
      (symmetry-dark-bottom)
      (zone
         (name promotion-zone)
         (players Black)
         (positions b10 d10 f10 h10 j10)
      )
      (zone
         (name promotion-zone)
         (players Red)
         (positions a1 c1 e1 g1 i1)
      )
   )
   (board-setup
      (Black (Checker a1 c1 e1 g1 i1 b2 d2 f2 h2 j2 a3 c3 e3 g3 i3) )
      (Red   (Checker b10 d10 f10 h10 j10 a9 c9 e9 g9 i9 b8 d8 f8 h8 j8) )
   )
)

(variant
   (title "Checkers 10x10 (20 men)")
   (description "如果你有多个吃子路线可以选择，你必须选择可以吃掉最多棋子的路线。\\其他同西洋跳棋。")
   (option "maximal captures" 2)
   (board
      (image-10x10)
      (grid-10x10)
      (symmetry-dark-bottom)
      (zone
         (name promotion-zone)
         (players Black)
         (positions b10 d10 f10 h10 j10)
      )
      (zone
         (name promotion-zone)
         (players Red)
         (positions a1 c1 e1 g1 i1)
      )
   )
   (board-setup
      (Black (Checker a1 c1 e1 g1 i1 b2 d2 f2 h2 j2 a3 c3 e3 g3 i3 b4 d4 f4 h4 j4) )
      (Red   (Checker a7 c7 e7 g7 i7 b10 d10 f10 h10 j10 a9 c9 e9 g9 i9 b8 d8 f8 h8 j8) )
   )
)


(variant
   (title "-") ; --------------------------------------------------------
)


; check for other directions and delete the pieces if needed
(define eatthem
    a1
    (while (not-position? offboard) 
       (if (or (piece? XChecker) (piece? XKing)) capture)
    next)		        
)
(define realenemy   (and enemy? (not-piece? XChecker) (not-piece? XKing)))
(define canjumpthis (and enemy? (not-piece? XChecker) (not-piece? XKing) (on-board? $1) (empty? $1)))

; eat flag means that you can take away the captured pieces now

; Eat check for a man (checker)
(define checkm-a-direction
   (if (on-board? $1) $1 (if (canjumpthis $1) (set-flag eat false)))
)
(define checkm-to-eat
   (set-flag eat true)
   (checkm-a-direction $1) back
   (checkm-a-direction $2) back
   (checkm-a-direction $3)
)
(define checkm-to-eat7
   (set-flag eat true)
   (checkm-a-direction $1) back
   (checkm-a-direction $2) back
   (checkm-a-direction $3) back
   (checkm-a-direction $4) back
   (checkm-a-direction $5) back
   (checkm-a-direction $6) back
   (checkm-a-direction $7)
)

; Eat check for a king
(define check-a-direction
   back
   (while (and (on-board? $1) (empty? $1)) $1 ) ; skip empties
   (if (on-board? $1) $1
      (if (canjumpthis $1) (set-flag eat false))
   )
)
(define check-to-eat 
   (set-flag eat true)
   (check-a-direction $1)
   (check-a-direction $2)
   (check-a-direction $3)
)
(define check-to-eat7 
   (set-flag eat true)
   (check-a-direction $1)
   (check-a-direction $2)
   (check-a-direction $3)
   (check-a-direction $4)
   (check-a-direction $5)
   (check-a-direction $6)
   (check-a-direction $7)
)

(define do-capture $1 capture (eatthem) back)

; Add for International Checkers man
; $1 - forward  $2 - 90 degree backward  $3 - other direction
(define ichecker-jump-add
   mark ; destination
   (if (in-zone? promotion-zone)
      (if (on-board? $2) $2 
         (if (canjumpthis $2)
            back (add-partial jumptype)
          else (go from) (do-capture $1) (add King) )
       else (go from) (do-capture $1) (add King) )
    else ; not promoting
      (checkm-to-eat $1 $2 $3) back
      (if (flag? eat) (go from) (do-capture $1))
      (add-partial jumptype)
   )
)

; Add for Frisian Checkers man
; $1 - forward  $2 - 90 degree backward  $3 - other direction
(define fchecker-jump-add
   mark ; destination
   (checkm-to-eat7 $1 $2 $3 $4 $5 $6 $7) back
   (if (in-zone? promotion-zone)
      (if (flag? eat) (go from) (do-capture $1) (add King)
       else (add-partial jumptype))
    else ; not promoting
      (if (flag? eat) (go from) (do-capture $1))
      (add-partial jumptype)
   )
)

; Add for a Russian Checkers man
; $1 - forward  $2 - 90 degree motion  $3 - other direction
(define rchecker-jump-add
   mark ; destination
   (check-to-eat $1 $2 $3) back
   (if (in-zone? promotion-zone)
      (if (flag? eat) (go from) (do-capture $1) (add King)
       else (add-partial King jumptype))
   else ; not promoting
      (if (flag? eat) (go from) (do-capture $1) add
       else (add-partial jumptype))
   )
)


(define markit (if (piece? King) (change-type XKing) 
        else (if (piece? Checker) (change-type XChecker) else (verify empty?)))
)

(define ichecker-jump   (from $1 (verify (realenemy)) (markit) $1 (verify empty?) to
     (ichecker-jump-add $1 $2 $3)) )

(define fchecker-jump   (from $1 (verify (realenemy)) (markit) $1 (verify empty?) to
     (fchecker-jump-add $1 $2 $3 $4 $5 $6 $7)) )

(define rchecker-jump   (from $1 (verify (realenemy)) (markit) $1 (verify empty?) to
     (rchecker-jump-add $1 $2 $3)) )

(define long-king-shift ($1 (verify empty?) add $1 (verify empty?) add $1 (verify empty?) add
                         $1 (verify empty?) add $1 (verify empty?) add $1 (verify empty?) add
                         $1 (verify empty?) add $1 (verify empty?) add  $1 (verify empty?) add))
(define long-king-jump  ( from $1 (while empty? $1)
                          (verify (realenemy)) $1
                          (while empty?
                             to mark    
                             (check-to-eat $1 $2 $3)
                             (go from) $1 (while empty? $1) (markit)             
                             (if (flag? eat) capture (eatthem))
                             back (add-partial jumptype)
                             $1
                          )
                        )
)
; can move orthogonally
(define flong-king-jump ( from $1 (while empty? $1)
                          (verify (realenemy)) $1
                          (while empty?
                             to mark    
                             (check-to-eat7 $1 $2 $3 $4 $5 $6 $7)
                             (go from) $1 (while empty? $1) (markit)             
                             (if (flag? eat) capture (eatthem))
                             back (add-partial jumptype)
                             $1
                          )
                        )
)
; lands immediately past captured
(define csg-long-king-jump ( from $1 (while empty? $1)
                             (verify (realenemy)) $1
                             (if empty?
                                to mark    
                                (check-to-eat $1 $2 $3)
                                (go from) $1 (while empty? $1) (markit)             
                                (if (flag? eat) capture (eatthem))
                                back (add-partial jumptype)
                             )
                           )
)

(define turk-king-jump (from $1 (while empty? $1)
                        (verify enemy?) $1
                        (while empty? mark (while empty? $2) capture back
                            (add-partial jumptype) $1)
                       )
)

(define international-defs
   (turn-order Red Black)
   (option "maximal captures" true)
   (board
      (board-defs-international)
   )
   (board-setup
      (Red   (Checker a1 c1 e1 g1 i1 b2 d2 f2 h2 j2 a3 c3 e3 g3 i3 b4 d4 f4 h4 j4) )
      (Black (Checker a7 c7 e7 g7 i7 b10 d10 f10 h10 j10 a9 c9 e9 g9 i9 b8 d8 f8 h8 j8) )
   )
)

(define international-Checker
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp"
             Black "images\Checkers\Shaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (description "Checkers move diagonally forward to empty squares and capture
              by jumping diagonally in any direction.  They may
	      also capture an enemy piece (or a series of them) by jumping over it
	      in any diagonal direction.
	      A Checker landing on the far side may promote to a King.")
      (help "Checker: moves diagonally forward, jumps to capture")
      (moves
         (move-type jumptype)
         (ichecker-jump nw sw ne)
         (ichecker-jump ne se nw)
         (ichecker-jump se ne sw)
         (ichecker-jump sw nw se)

         (move-type nonjumptype)
         (checker-shift nw)
         (checker-shift ne)
      )
   )
)
(define international-King 
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\chkrRK.bmp" "images\Checkers\chkrRK.bmp"
             Black "images\Checkers\Shaag\chkrBK.bmp" "images\Checkers\chkrBK.bmp")
      (description "Kings can slide diagonally in any direction, or capture pieces
	    by jumping diagonally over them.")
      (help "King: moves diagonally any way, jumps to capture")
      (moves
         (move-type jumptype)
         (long-king-jump nw ne sw)
         (long-king-jump ne nw se)
         (long-king-jump sw nw se)
         (long-king-jump se sw ne)
 
         (move-type nonjumptype)
         (long-king-shift nw)
         (long-king-shift ne)
         (long-king-shift sw)
         (long-king-shift se)
      )
   )
)

(variant
   (title "International Checkers 10x10")
   (description "国际跳棋\\规则：\
	①：棋子可以斜向后跳吃。\
	②：棋子到达对方底线时若还可以吃子，可以不升变，继续吃子。但若选择升级成王，则无法继续吃子。\
	③：王可以移动任意格数，跳吃也适用。\
	④：棋子移动结束之后，被吃的棋子才会提走。\
	⑤：必须选择吃子最多的路线。")
   (history "International Checkers was invented in 1723 in France, where it is
      still played.  It is still popular in France and a number of other 
      countries as well.")
   (international-defs)
   (international-King)
   (international-Checker)
)

(variant
   (title "Frisian Checkers 10x10")
   (description "弗里斯兰跳棋\\规则：\
	①：棋子可以斜向后跳吃。\
	②：棋子到达对方底线时若还可以吃子，可以不升变，继续吃子。但若选择升级成王，则无法继续吃子。\
	③：王可以移动任意格数，跳吃也适用。\
	④：棋子移动结束之后，被吃的棋子才会提走。\
	⑤：必须选择吃子最多的路线。\
	⑥：所有棋子均可横向跳吃，但必须落在黑格。")
   (history "This form is played around the Frisian Islands in the North Sea.")
   (international-defs)
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp"
             Black "images\Checkers\Shaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (description "Checkers can move one square forward, diagonally or straight, to
              an empty square and capture
              by jumping diagonally in any direction.  They may
	      also capture an enemy piece (or a series of them) by jumping over it.
	      A Checker landing on the far side may promote to a King.")
      (help "Checker: moves forward (diagonally or straight), jumps to capture")
      (moves
         (move-type jumptype)
         (fchecker-jump nw sw ne nn ee ss ww)
         (fchecker-jump ne se nw nn ee ss ww)
         (fchecker-jump se ne sw nn ee ss ww)
         (fchecker-jump sw nw se nn ee ss ww)
         (fchecker-jump nn ee ww nw ne sw se)
         (fchecker-jump ss ee ww nw ne sw se)
         (fchecker-jump ww nn ss nw ne sw se)
         (fchecker-jump ee nn ss nw ne sw se)

         (move-type nonjumptype)
         (checker-shift nw)
         (checker-shift ne)
      )
   )
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\chkrRK.bmp" "images\Checkers\chkrRK.bmp"
             Black "images\Checkers\Shaag\chkrBK.bmp" "images\Checkers\chkrBK.bmp")
      (description "Kings can slide diagonally in any direction, or capture pieces
	    by jumping diagonally over them.")
      (help "King: moves diagonally any way, jumps to capture")
      (moves
         (move-type jumptype)
         (flong-king-jump nw ne sw nn ee ss ww)
         (flong-king-jump ne nw se nn ee ss ww)
         (flong-king-jump sw nw se nn ee ss ww)
         (flong-king-jump se sw ne nn ee ss ww)
         (flong-king-jump nn ee ww nw ne sw se)
         (flong-king-jump ss ee ww nw ne sw se)
         (flong-king-jump ww nn ss nw ne sw se)
         (flong-king-jump ee nn ss nw ne sw se)
 
         (move-type nonjumptype)
         (long-king-shift nw)
         (long-king-shift ne)
         (long-king-shift sw)
         (long-king-shift se)
      )
   )
)



(define itchecker-jump   ($1 (verify enemy?) (verify (piece? Checker))
                         capture $1 (verify empty?) (checker-jump-add)) )
(define itking-jump      ($1 (verify enemy?) capture $1 (verify empty?) (add-partial kingjumptype)) )

(variant
   (title "Italian Checkers")
   (description "意大利跳棋\\变体规则：\
	①：你必须选择吃子最多的路线，如果这样的路线有多个，你必须选择吃王数最多的路线。\
	②：未升级的棋子无法吃王。\
	③：若兵和王都可以吃子，必须优先走王。")
   (move-priorities kingjumptype jumptype nonjumptype)
   (option "maximal captures" 2)
   (board
      (image-8x8-mirrored)
      (grid-8x8)
      (symmetry-dark-bottom)
      (promotion-zone-8x8-mirrored)
   )
   (board-setup-8x8-mirrored)
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp"
             Black "images\Checkers\Shaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (description "Checkers move diagonally forward to empty squares.  They may
             also capture an enemy piece (or a series of them) by jumping over it.
             A Checker reaching the far side may promote to a King.  In Italian
             Checkers a Checker may not capture a King.")
      (help "Checker: moves diagonally forward, jumps to capture")
      (moves
         (move-type jumptype)
         (itchecker-jump nw)
         (itchecker-jump ne)

         (move-type nonjumptype)
         (checker-shift nw)
         (checker-shift ne)
      )
   )
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\chkrRK.bmp" "images\Checkers\chkrRK.bmp"
             Black "images\Checkers\Shaag\chkrBK.bmp" "images\Checkers\chkrBK.bmp")
      (description "Kings can move a single step diagonally in any direction, or capture pieces
             by jumping diagonally over them.")
      (help "King: moves diagonally any way, jumps to capture")
      (moves
         (move-type kingjumptype)
         (itking-jump nw)
         (itking-jump ne)
         (itking-jump sw)
         (itking-jump se)

         (move-type nonjumptype)
         (king-shift nw)
         (king-shift ne)
         (king-shift sw)
         (king-shift se)
      )
   )
)

(variant
   (title "German Checkers")
   (description "德国跳棋：\布局不同，其他与法国跳棋相同。\
	①：棋子可以斜向后跳吃。\
	②：棋子到达对方底线时若还可以吃子，可以不升变，继续吃子。但若选择升级成王，则无法继续吃子。\
	③：王可以移动任意格数，跳吃也适用。\
	④：棋子移动结束之后，被吃的棋子才会提走。\
	⑤：必须选择吃子最多的路线。")
   (history "This game is also known as Little International Checkers or German-Polish
    Checkers as it is popular in Germany and Poland.")
   (option "maximal captures" true)
   (international-King)
   (international-Checker)
)

(variant
   (title "Russian Checkers")
   (description "俄国跳棋\\变体规则：\
	①：棋子可以斜向后跳吃。\
	②：棋子到达对方底线时若还可以吃子，可以把它升级成王后，继续吃子。\
	③：王可以移动任意格数，跳吃也适用。\
	④：棋子移动结束之后，被吃的棋子才会提走。\
	⑤：王只能通过同一个棋子一次。")
   (history "This game is also known as Shaski.")
   (turn-order Red Black)
   (board
      (image-8x8)
      (grid-8x8)
      (symmetry-light-bottom)
      (next-links-8x8)
      (promotion-zone-8x8-light-bottom)
   )
   (board-setup-8x8-light-bottom)
   (international-King)
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp"
             Black "images\Checkers\Shaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (description "Checkers move diagonally forward to empty squares and capture
              by jumping diagonally in any direction.  They may
	      also capture an enemy piece (or a series of them) by jumping over it.
	      A Checker landing on the far side may promote to a King.")
      (help "Checker: moves diagonally forward, jumps to capture")
      (moves
         (move-type jumptype)
         (rchecker-jump nw sw ne)
         (rchecker-jump ne se nw)
         (rchecker-jump se ne sw)
         (rchecker-jump sw nw se)

         (move-type nonjumptype)
         (checker-shift nw)
         (checker-shift ne)
      )
   )
)

(variant
   (title "Pool Checkers")
   (description "美国跳棋\\变体规则：\
	①：棋子可以斜向后跳吃。\
	②：棋子到达对方底线时若还可以吃子，可以不升变，继续吃子。但若选择升级成王，则无法继续吃子。\
	③：王可以移动任意格数，跳吃也适用。\
	④：棋子移动结束之后，被吃的棋子才会提走。")
   (history "Sometimes this is called Spanish Pool Checkers or Spanish Checkers,
    but the Spanish Checkers variant we provide here is different.")
   (international-King)
   (international-Checker)
)

(variant
   (title "Spanish Checkers")
   (description "西班牙跳棋\\变体规则：\
	①：王可以移动任意格数，跳吃也适用。\
	②：棋子移动结束之后，被吃的棋子才会提走。\
	③：王只能通过同一个棋子一次。\
	④：必须选择吃子最多的路线。")
   (option "maximal captures" true)
   (turn-order Red Black)
   (board
      (image-8x8-mirrored)
      (grid-8x8)
      (symmetry-light-bottom)
      (promotion-zone-8x8-mirrored-light-bottom)
      (next-links-8x8-mirrored)
   )
   (board-setup-8x8-mirrored-light-bottom)
   (international-King)
)

(variant
   (title "Central-South German Checkers")
   (description "德国南部的跳棋规则\\
	①：王可以移动任意格数，跳吃也适用。\
	②：棋子移动结束之后，被吃的棋子才会提走。\
	③：王只能通过一个棋子一次。\
	④：必须选择吃子最多的路线。\
	⑤：王吃子时，只能停留在被吃的子后面一格。")
   (option "maximal captures" true)
   (turn-order Red Black)
   (board
      (image-8x8-mirrored)
      (grid-8x8)
      (symmetry-light-bottom)
      (promotion-zone-8x8-mirrored-light-bottom)
      (next-links-8x8-mirrored)
   )
   (board-setup-8x8-mirrored-light-bottom)
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\chkrRK.bmp" "images\Checkers\chkrRK.bmp"
             Black "images\Checkers\Shaag\chkrBK.bmp" "images\Checkers\chkrBK.bmp")
      (description "Kings can slide diagonally in any direction, or capture pieces
	    by jumping diagonally over them.  The King must land immediately
	    beyond the captured piece.")
      (help "King: moves diagonally any way, jumps to capture")
      (moves
         (move-type jumptype)
         (csg-long-king-jump nw ne sw)
         (csg-long-king-jump ne nw se)
         (csg-long-king-jump sw nw se)
         (csg-long-king-jump se sw ne)
 
         (move-type nonjumptype)
         (long-king-shift nw)
         (long-king-shift ne)
         (long-king-shift sw)
         (long-king-shift se)
      )
   )
)

(variant
   (title "Scandinavian Checkers")
   (description "挪威跳棋\\变体规则：\
	①：王可以移动任意格数，跳吃也适用。\
	④：棋子移动结束之后，被吃的棋子才会提走。\
	③：王只能通过一个子一次。\
	④：兵吃子时，可以跳到被吃子后面的任意位置。\
	⑤：必须选择吃子最多的路线。")
   (option "maximal captures" true)
   (turn-order Red Black)
   (board
      (image-8x8-mirrored)
      (grid-8x8)
      (symmetry-light-bottom)
      (promotion-zone-8x8-mirrored-light-bottom)
      (next-links-8x8-mirrored)
   )
   (board-setup-8x8-mirrored-light-bottom)
   (international-King)
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp"
             Black "images\Checkers\Shaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (description "Checkers move diagonally forward to empty squares.  They may
             also capture an enemy piece (or a series of them) by jumping over it.
             When jumping they may move any number of squares.
	     A Checker reaching the far side may promote to a King.")
      (help "Checker: shifts diagonally forward, long-jumps to capture")
      (moves
         (move-type jumptype)
         (scchecker-jump nw)
         (scchecker-jump ne)

         (move-type nonjumptype)
         (checker-shift nw)
         (checker-shift ne)
      )
   )
)

(variant
   (title "-") ; *********
)

(define turkish-defs
   (option "maximal captures" true)
   (board
      (board-defs-turkish)
   )
   (board-setup
      (Black (Checker a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f3 g3 h3) )
      (Red   (Checker a7 b7 c7 d7 e7 f7 g7 h7 a6 b6 c6 d6 e6 f6 g6 h6) )
   )
   (loss-condition (Red Black) (pieces-remaining 0) )
   (loss-condition (Red Black) stalemated)
   (loss-condition (Red Black) (and (pieces-remaining 1 Checker)
                                    (pieces-remaining 0 King)
                                    (not (total-piece-count 0 King))
                               ) 
   ) 
)

(variant
   (title "Gothic Checkers")
   (description "棋子可以八个方向跳吃。其他同国际跳棋。.")
   (history "This is supposedly the oldest form of checkers played in Germany.")
   (board
      (board-defs-turkish)
   )
   (board-setup
      (Black (Checker a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2) )
      (Red   (Checker a7 b7 c7 d7 e7 f7 g7 h7 a8 b8 c8 d8 e8 f8 g8 h8) )
   )
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\Turkish_chkrRM.bmp" "images\Checkers\Turkish_chkrRM.bmp"
             Black "images\Checkers\Shaag\Turkish_chkrBM.bmp" "images\Checkers\Turkish_chkrBM.bmp")
      (description "Checkers move forward, left or right to empty squares.  They may
	      also capture an enemy piece (or a series of them) by jumping over it.
	      A Checker landing on the far side may promote to a King.")
      (help "Checker: moves forward, left, right, jumps to capture")
      (moves
         (move-type jumptype)
         (checker-jump n)
         (checker-jump e)
         (checker-jump w)
         (checker-jump nw)
         (checker-jump ne)

         (move-type nonjumptype)
         (checker-shift nw)
         (checker-shift ne)
      )
   )
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\Turkish_chkrRK.bmp" "images\Checkers\Turkish_chkrRK.bmp"
            Black "images\Checkers\Shaag\Turkish_chkrBK.bmp" "images\Checkers\Turkish_chkrBK.bmp")
      (description "Kings can move a single step diagonally in any direction, or capture pieces
	    by jumping diagonally over them.")
      (help "King: moves diagonally any way, jumps to capture")
      (moves
         (move-type jumptype)
         (king-jump nw)
         (king-jump ne)
         (king-jump sw)
         (king-jump se)
         (king-jump n)
         (king-jump s)
         (king-jump e)
         (king-jump w)

         (move-type nonjumptype)
         (king-shift nw)
         (king-shift ne)
         (king-shift sw)
         (king-shift se)
      )
   )
)

(variant
   (title "Turkish Checkers")
   (description "兵可以向前或向左右移动一格，或跳吃，王可以四方向无限移动和跳吃。其他同国际跳棋。")
   (history "Turkish Checkers is not only played in Turkey, but also in many parts of
    the former Turkish empire, from Egypt to the Balkans.")
   (turkish-defs)
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\Turkish_chkrRM.bmp" "images\Checkers\Turkish_chkrRM.bmp"
             Black "images\Checkers\Shaag\Turkish_chkrBM.bmp" "images\Checkers\Turkish_chkrBM.bmp")
      (description "Checkers move forward, left or right to empty squares.  They may
	      also capture an enemy piece (or a series of them) by jumping over it.
	      A Checker landing on the far side may promote to a King.")
      (help "Checker: moves forward, left, right, jumps to capture")
      (moves
         (move-type jumptype)
         (checker-jump n)
         (checker-jump e)
         (checker-jump w)

         (move-type nonjumptype)
         (checker-shift n)
         (checker-shift e)
         (checker-shift w)
      )
   )
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\Turkish_chkrRK.bmp" "images\Checkers\Turkish_chkrRK.bmp"
             Black "images\Checkers\Shaag\Turkish_chkrBK.bmp" "images\Checkers\Turkish_chkrBK.bmp")
      (description "Kings can slide up, down, left, right, or diagonally, or capture pieces
	    by jumping over them not diagonally.")
      (help "King: moves left, right, up, down, diagonally, jumps to capture (not diagonally)")
      (moves
         (move-type jumptype)
         (turk-king-jump n s)
         (turk-king-jump e w)
         (turk-king-jump s n)
         (turk-king-jump w e)
 
         (move-type nonjumptype)
         (long-king-shift n)
         (long-king-shift e)
         (long-king-shift s)
         (long-king-shift w)
      )
   )
)

(variant
   (title "Armenian Checkers")
   (description "兵可以向前方、斜前、左右走一格。王可以八方移动，但是兵和王都只能横竖跳吃。其他同国际跳棋。")
   (turkish-defs)
   (piece
      (name Checker)
      (image Red "images\Checkers\Shaag\Turkish_chkrRM.bmp" "images\Checkers\Turkish_chkrRM.bmp"
             Black "images\Checkers\Shaag\Turkish_chkrBM.bmp" "images\Checkers\Turkish_chkrBM.bmp")
      (description "Checkers move forward, left, right or diagonally forward to empty squares.  They may
	      also capture an enemy piece (or a series of them) by jumping over it, but not diagonally.
	      A Checker landing on the far side may promote to a King.")
      (help "Checker: moves or jumps to capture forward, left, right. Moves forward diagonally.")
      (moves
         (move-type jumptype)
         (checker-jump n)
         (checker-jump e)
         (checker-jump w)

         (move-type nonjumptype)
         (checker-shift n)
         (checker-shift e)
         (checker-shift w)
         (checker-shift ne)
         (checker-shift nw)
      )
   )
   (piece
      (name King)
      (image Red "images\Checkers\Shaag\Turkish_chkrRK.bmp" "images\Checkers\Turkish_chkrRK.bmp"
             Black "images\Checkers\Shaag\Turkish_chkrBK.bmp" "images\Checkers\Turkish_chkrBK.bmp")
      (description "Kings can slide up, down, left or right, or capture pieces
	    by jumping over them.  It can move, but not capture, diagonally.")
      (help "King: moves or jumps to capture left, right, up, down. Moves but not captures diagonally.")
      (moves
         (move-type jumptype)
         (turk-king-jump n s)
         (turk-king-jump e w)
         (turk-king-jump s n)
         (turk-king-jump w e)
 
         (move-type nonjumptype)
         (long-king-shift n)
         (long-king-shift e)
         (long-king-shift s)
         (long-king-shift w)
         (long-king-shift ne)
         (long-king-shift nw)
         (long-king-shift se)
         (long-king-shift sw)
      )
   )
)

